package com.fnzx.dao;

import com.fnzx.entity.CommentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * 
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-10-23 22:20:01
 */
@Mapper
public interface CommentDao extends BaseMapper<CommentEntity> {
    @Select("select * from comment where demand_id=#{demandId} ORDER BY gmt_created")
    public List<CommentEntity> getAll(@Param("demandId") Long demandId);

    @Select("select * from comment where parent_id=0 and demand_id=#{demandId} ORDER BY gmt_created")
    public List<CommentEntity> getParent(@Param("demandId") Long demandId);

    @Select("select * from comment where parent_id=#{parentId} ORDER BY gmt_created")
   public List<CommentEntity> getSon(@Param("parentId") Long parentId);


}
